package com.jy.wms.web;

import com.joyi.gate.comm.SessionInfo;
import com.joyi.gate.safety.vo.UserInfo;
import com.jy.wms.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

/**
 * 库位组 路由跳转
 * Created by syh on 2018/7/30.
 */
@Controller
@RequestMapping("/groupRouter")
public class WmsLibrarypositionGroupRouter {
    @Autowired
    SysMenuService menuService;
    /**
     * 跳转查询列表页
     * @param model
     * @return
     */
    @RequestMapping(value = "/getGroupList/{menu}")
    public String getWmsLibrarypositiongroupList(@PathVariable("menu") String menu, Model model){
        model.addAttribute("functions",menuService.getFunctions(menu));
        return  "base/wmsLibrarypositiongroup/listWmsLibrarypositiongroup";
    }

    /**
     * 跳转新增生成页面
     * @param model
     * @return
     */
    @RequestMapping(value = "toAddgroup")
    public String toAddgroup(Model model,HttpSession session){
        UserInfo userinfo= (UserInfo) session.getAttribute(SessionInfo.USER_INFO);
        String ckmc=String.valueOf(userinfo.getUser().getOrgName());//仓库名称
        model.addAttribute("ckmc",ckmc);
        return  "base/wmsLibrarypositiongroup/addWmsLibrarypositiongroup";
    }
    /**
     * 跳转编辑生成页面
     * @param model
     * @param id
     * @return
     */
    @RequestMapping(value = "toEditgroup")
    public String toEditgroup(String id,Model model,HttpSession session){
        UserInfo userinfo= (UserInfo) session.getAttribute(SessionInfo.USER_INFO);
        String ckmc=String.valueOf(userinfo.getUser().getOrgName());//仓库名称
        model.addAttribute("ckmc",ckmc);
        model.addAttribute("id",id);
        return  "base/wmsLibrarypositiongroup/editWmsLibrarypositiongroup";
    }

    /**
     * 跳转查看库位页面
     * @param id
     * @param kwzlx
     * @param model
     * @return
     */
    @RequestMapping(value = "toChakanKw")
    public String toChakanKw(String id,String kwzlx,Model model){
        model.addAttribute("id",id);
        model.addAttribute("kwzlx",kwzlx);
        return  "base/wmsLibrarypositiongroup/chakanPosition";
    }

    /**
     * 跳新增库位页面
     * @param kwzid
     * @param kwzlx
     * @param model
     * @return
     */
    @RequestMapping(value = "toChakanKwAdd")
    public String toChakanKwAdd(String kwzid,String kwzlx,Model model){
        model.addAttribute("kwzid",kwzid);
        model.addAttribute("kwzlx",kwzlx);
        return  "base/wmsLibrarypositiongroup/chakanPositionAdd";
    }

    /**
     * 跳转库位组详情页面
     * @param id
     * @param model
     * @return
     */
    @RequestMapping(value = "/getFindKwz")
    public String getFindKwz(String id, Model model) {
        model.addAttribute("id",id);
        return "base/wmsLibrarypositiongroup/positiongroupXiangxi";
    }
}